home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group02b.txt / 000044_icon-group-sender_Thu Sep 19 12:25:39 2002.msg < prev    next >
Internet Message Format  |  2003-01-02  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id g8JJOrY08547
  4.     for icon-group-addresses; Thu, 19 Sep 2002 12:24:53 -0700 (MST)
  5. Message-Id: <200209191924.g8JJOrY08547@baskerville.CS.Arizona.EDU>
  6. Date: Thu, 19 Sep 2002 08:57:54 -0700 (MST)
  7. From: Gregg Townsend <gmt>
  8. To: icon-group
  9. Subject: Icon as a Scripting Language
  10. Errors-To: icon-group-errors@cs.arizona.edu
  11. Status: RO
  12.  
  13. >  From: "Andrew Hamm" <ahamm@mail.com>
  14. >  Date: Thu, 19 Sep 2002 12:57:52 +1000
  15. >  
  16. >  > 4) Icon as a Scripting Language
  17. >  
  18. >  Interesting idea. In principle, some simple hack can already be done using
  19. >  hash-bang lines and possibly a bit of disguised shell-code. Isn't there an
  20. >  icont argument which asks for automatic execution of the resulting object?
  21. >  If there isn't it can surely be added.
  22. >  
  23. >  To do this "properly" on UNIX, the compiler could probably write to a tmp
  24. >  file (not linked into a directory) and then hand the open file handles off
  25. >  to a cooperating iconx which can slurp up the icode from the tmp file
  26. >  handles and then close them, resulting in their deallocation. This is a very
  27. >  simple improvement to the compiler and runner, and I wouldn't really class
  28. >  this as an extension to Icon, because it's more mechanical than anything
  29. >  else.
  30.  
  31. This feature is present in the current version of Icon for Unix.
  32. You can enter "icon foo.icn" to execute an Icon program, or you can
  33. make the source file executable and head it with the magic string
  34.    #!/usr/bin/env icon
  35. to run it directly.  There is also " icon -P 'program' " for embedding
  36. a tiny program in a larger shell script, as is commonly done with "sed".
  37.  
  38. I believe it is done "properly":  the current directory doesn't need to
  39. be writable (you can run from CD or whatever) and the temporary files
  40. are cleaned up afterward.
  41.  
  42. For more details see the new "icon" (not "icont") man page.  There's a
  43. copy on the web at
  44.    http://www.cs.arizona.edu/icon/v941/icon.txt
  45.  
  46. ---------------------------------------------------------------------------
  47. Gregg Townsend         Staff Scientist      The University of Arizona
  48. gmt@cs.arizona.edu     Computer Science     Tucson, Arizona, USA
  49.